package com.sikaryofficial.system.load;

import com.sikaryofficial.system.manager.UserAgeCacheManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

/**
 * @author : qinjinyuan
 * @desc : 加载有效活动的积分信息
 * @date : 2023/11/29 9:28
 */
@Component
@Slf4j
@RefreshScope
public class UserNickNameLoader implements CommandLineRunner {
    @Value("${hismk.system.load.nickName}")
    private Boolean loadFlag;
    @Autowired
    private UserAgeCacheManager userAgeCacheManager;

    /**
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) {
        if (Boolean.FALSE.equals(loadFlag)) {
            log.info("不加载数据");
            return;
        }
        userAgeCacheManager.updateNickName();
    }
}
